﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace LoveNote.UI.Converters
{
    public class SexToColorConverter : IValueConverter
    {
        //性别转换成颜色
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return Brushes.Red;//出错
            switch (value.ToString())
            {
                case "保密":
                    return new SolidColorBrush(Color.FromRgb(231, 231, 231));//灰色
                case "男":
                    return new SolidColorBrush(Color.FromRgb(80, 156, 178));//蓝色
                case "女":
                    return new SolidColorBrush(Color.FromRgb(202, 110, 196));//粉色
                default:
                    return Brushes.Gray;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
